<%-- 
    Document   : exam-details
    Created on : Feb 19, 2012, 4:21:34 PM
    Author     : PhucAn
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@include  file="../handler/exam-details-action.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <script type="text/javascript">
            function remove(idx){
                $.ajax({
                    type:"POST",
                    url:"../handler/exam-details-removeq-action.jsp",
                    data:"qid="+idx+"&exid=${exam.id}",
                    success:function(msg){
                        alert(msg.trim());
                        $('#row-'+idx).remove();
                    }
                }
            )
            }
        </script>
    </head>
    <body>
        <h3>${exam.name}</h3>
        <table class="data-table">
            <tr>
                <th>Question</th>
                <th>Category</th>
                <th>Level</th>
                <th></th>
            </tr>
            <c:forEach var="q" items="${list}">
                <tr id="row-${q.id}">
                    <td>${q.content}</td>
                    <td>${q.category.id}</td>
                    <td>${q.level}</td>
                    <td>
                        <a href="javascript:remove(${q.id});">Remove</a>                     
                    </td>
                </tr>
            </c:forEach>
        </table>
    </body>
</html>
